#pragma once

/**
 * Hardware pin. This enum is platform-specific.
 */
enum class Gpio : uint16_t {
	Unassigned = 0,
	// only used as return value of 'parseBrainPin' function do we really this this logic special value at all?!
	Invalid = 1,

	A0 = 2,
	A1 = 3,
	A2 = 4,
	A3 = 5,
	A4 = 6,
	A5 = 7,
	A6 = 8,
	A7 = 9,
	A8 = 10,
	A9 = 11,
	A10 = 12,
	A11 = 13,
	A12 = 14,
	A13 = 15,
	A14 = 16,
	A15 = 17,

	B0 = 18,
	B1 = 19,
	B2 = 20,
	B3 = 21,
	B4 = 22,
	B5 = 23,
	B6 = 24,
	B7 = 25,
	B8 = 26,
	B9 = 27,
	B10 = 28,
	B11 = 29,
	B12 = 30,
	B13 = 31,
	B14 = 32,
	B15 = 33,

	C0 = 34,
	C1 = 35,
	C2 = 36,
	C3 = 37,
	C4 = 38,
	C5 = 39,
	C6 = 40,
	C7 = 41,
	C8 = 42,
	C9 = 43,
	C10 = 44,
	C11 = 45,
	C12 = 46,
	C13 = 47,
	C14 = 48,
	C15 = 49,

	D0 = 50,
	D1 = 51,
	D2 = 52,
	D3 = 53,
	D4 = 54,
	D5 = 55,
	D6 = 56,
	D7 = 57,
	D8 = 58,
	D9 = 59,
	D10 = 60,
	D11 = 61,
	D12 = 62,
	D13 = 63,
	D14 = 64,
	D15 = 65,

	E0 = 66,
	E1 = 67,
	E2 = 68,
	E3 = 69,
	E4 = 70,
	E5 = 71,
	E6 = 72,
	E7 = 73,
	E8 = 74,
	E9 = 75,
	E10 = 76,
	E11 = 77,
	E12 = 78,
	E13 = 79,
	E14 = 80,
	E15 = 81,

	F0 = 82,
	F1 = 83,
	F2 = 84,
	F3 = 85,
	F4 = 86,
	F5 = 87,
	F6 = 88,
	F7 = 89,
	F8 = 90,
	F9 = 91,
	F10 = 92,
	F11 = 93,
	F12 = 94,
	F13 = 95,
	F14 = 96,
	F15 = 97,

	G0 = 98,
	G1 = 99,
	G2 = 100,
	G3 = 101,
	G4 = 102,
	G5 = 103,
	G6 = 104,
	G7 = 105,
	G8 = 106,
	G9 = 107,
	G10 = 108,
	G11 = 109,
	G12 = 110,
	G13 = 111,
	G14 = 112,
	G15 = 113,

	H0 = 114,
	H1 = 115,
	H2 = 116,
	H3 = 117,
	H4 = 118,
	H5 = 119,
	H6 = 120,
	H7 = 121,
	H8 = 122,
	H9 = 123,
	H10 = 124,
	H11 = 125,
	H12 = 126,
	H13 = 127,
	H14 = 128,
	H15 = 129,

	/* Used by 176-pin STM32 MCUs */
	I0 = 130,
	I1 = 131,
	I2 = 132,
	I3 = 133,
	I4 = 134,
	I5 = 135,
	I6 = 136,
	I7 = 137,
	I8 = 138,
	I9 = 139,
	I10 = 140,
	I11 = 141,
	I12 = 142,
	I13 = 143,
	I14 = 144,
	I15 = 145,

  /* Used by 208-pin STM32 MCUs */
	J0 =  146,
	J1 =  147,
	J2 =  148,
	J3 =  149,
	J4 =  150,
	J5 =  151,
	J6 =  152,
	J7 =  153,
	J8 =  154,
	J9 =  155,
	J10 = 156,
	J11 = 157,
	J12 = 158,
	J13 = 159,
	J14 = 160,
	J15 = 161,

K0 = 162,
K1 = 163,
K2 = 164,
K3 = 165,
K4 = 166,
K5 = 167,
K6 = 168,
K7 = 169,
K8 = 170,
K9 = 171,
K10 = 172,
K11 = 173,
K12 = 174,
K13 = 175,
K14 = 176,
K15 = 177,

MC33972_PIN_1 = 178,
MC33972_PIN_2 = 179,
MC33972_PIN_3 = 180,
MC33972_PIN_4 = 181,
MC33972_PIN_5 = 182,
MC33972_PIN_6 = 183,
MC33972_PIN_7 = 184,
MC33972_PIN_8 = 185,
MC33972_PIN_9 = 186,
MC33972_PIN_10 = 187,
MC33972_PIN_11 = 188,
MC33972_PIN_12 = 189,
MC33972_PIN_13 = 190,
MC33972_PIN_14 = 191,
MC33972_PIN_15 = 192,
MC33972_PIN_16 = 193,
MC33972_PIN_17 = 194,
MC33972_PIN_18 = 195,
MC33972_PIN_19 = 196,
MC33972_PIN_20 = 197,
MC33972_PIN_21 = 198,
MC33972_PIN_22 = 199,

TLE8888_PIN_1 = 200,
TLE8888_PIN_2 = 201,
TLE8888_PIN_3 = 202,
TLE8888_PIN_4 = 203,
TLE8888_PIN_5 = 204,
TLE8888_PIN_6 = 205,
TLE8888_PIN_7 = 206,
TLE8888_PIN_8 = 207,
TLE8888_PIN_9 = 208,
TLE8888_PIN_10 = 209,
TLE8888_PIN_11 = 210,
TLE8888_PIN_12 = 211,
TLE8888_PIN_13 = 212,
TLE8888_PIN_14 = 213,
TLE8888_PIN_15 = 214,
TLE8888_PIN_16 = 215,
TLE8888_PIN_17 = 216,
TLE8888_PIN_18 = 217,
TLE8888_PIN_19 = 218,
TLE8888_PIN_20 = 219,
TLE8888_PIN_21 = 220,
TLE8888_PIN_22 = 221,
TLE8888_PIN_23 = 222,
TLE8888_PIN_24 = 223,
TLE8888_PIN_25 = 224,
TLE8888_PIN_26 = 225,
TLE8888_PIN_27 = 226,
TLE8888_PIN_28 = 227,
TLE8888_PIN_MR = 228,
TLE8888_PIN_KEY = 229,
TLE8888_PIN_WAKE = 230,

TLE6240_PIN_1 = 231,
TLE6240_PIN_2 = 232,
TLE6240_PIN_3 = 233,
TLE6240_PIN_4 = 234,
TLE6240_PIN_5 = 235,
TLE6240_PIN_6 = 236,
TLE6240_PIN_7 = 237,
TLE6240_PIN_8 = 238,
TLE6240_PIN_9 = 239,
TLE6240_PIN_10 = 240,
TLE6240_PIN_11 = 241,
TLE6240_PIN_12 = 242,
TLE6240_PIN_13 = 243,
TLE6240_PIN_14 = 244,
TLE6240_PIN_15 = 245,
TLE6240_PIN_16 = 246,

L9779_IGN_1 = 247,
L9779_IGN_2 = 248,
L9779_IGN_3 = 249,
L9779_IGN_4 = 250,
L9779_OUT_1 = 251,
L9779_OUT_2 = 252,
L9779_OUT_3 = 253,
L9779_OUT_4 = 254,
L9779_OUT_5 = 255,
L9779_OUT_6 = 256,
L9779_OUT_7 = 257,
L9779_OUT_8 = 258,
L9779_OUT_9 = 259,
L9779_OUT_10 = 260,
L9779_OUT_11 = 261,
L9779_OUT_12 = 262,
L9779_OUT_13 = 263,
L9779_OUT_14 = 264,
L9779_OUT_15 = 265,
L9779_OUT_16 = 266,
L9779_OUT_17 = 267,
L9779_OUT_18 = 268,
L9779_OUT_19 = 269,
L9779_OUT_20 = 270,
L9779_OUT_A = 271,
L9779_OUT_B = 272,
L9779_OUT_C = 273,
L9779_OUT_D = 274,
L9779_OUT_25 = 275,
L9779_OUT_26 = 276,
L9779_OUT_27 = 277,
L9779_OUT_28 = 278,
L9779_OUT_MRD = 279,
L9779_PIN_KEY = 280,

CAN_PIN_0 = 281,
CAN_PIN_1 = 282,
CAN_PIN_2 = 283,
CAN_PIN_3 = 284,
CAN_PIN_4 = 285,
CAN_PIN_5 = 286,
CAN_PIN_6 = 287,
CAN_PIN_7 = 288,

PROTECTED_PIN_0 = 289,
PROTECTED_PIN_1 = 290,
PROTECTED_PIN_2 = 291,
PROTECTED_PIN_3 = 292,
PROTECTED_PIN_4 = 293,
PROTECTED_PIN_5 = 294,
PROTECTED_PIN_6 = 295,
PROTECTED_PIN_7 = 296,
PROTECTED_PIN_8 = 297,
PROTECTED_PIN_9 = 298,
PROTECTED_PIN_10 = 299,
PROTECTED_PIN_11 = 300,
PROTECTED_PIN_12 = 301,
PROTECTED_PIN_13 = 302,
PROTECTED_PIN_14 = 303,
PROTECTED_PIN_15 = 304,

MC33810_0_OUT_0 = 305,
MC33810_0_OUT_1 = 306,
MC33810_0_OUT_2 = 307,
MC33810_0_OUT_3 = 308,
MC33810_0_GD_0 = 309,
MC33810_0_GD_1 = 310,
MC33810_0_GD_2 = 311,
MC33810_0_GD_3 = 312,

MC33810_1_OUT_0 = 313,
MC33810_1_OUT_1 = 314,
MC33810_1_OUT_2 = 315,
MC33810_1_OUT_3 = 316,
MC33810_1_GD_0 = 317,
MC33810_1_GD_1 = 318,
MC33810_1_GD_2 = 319,
MC33810_1_GD_3 = 320,

TLE9104_0_OUT_0 = 321,
TLE9104_0_OUT_1 = 322,
TLE9104_0_OUT_2 = 323,
TLE9104_0_OUT_3 = 324,
TLE9104_1_OUT_0 = 325,
TLE9104_1_OUT_1 = 326,
TLE9104_1_OUT_2 = 327,
TLE9104_1_OUT_3 = 328,
TLE9104_2_OUT_0 = 329,
TLE9104_2_OUT_1 = 330,
TLE9104_2_OUT_2 = 331,
TLE9104_2_OUT_3 = 332,
TLE9104_3_OUT_0 = 333,
TLE9104_3_OUT_1 = 334,
TLE9104_3_OUT_2 = 335,
TLE9104_3_OUT_3 = 336,
TLE9104_4_OUT_0 = 337,
TLE9104_4_OUT_1 = 338,
TLE9104_4_OUT_2 = 339,
TLE9104_4_OUT_3 = 340,
TLE9104_5_OUT_0 = 341,
TLE9104_5_OUT_1 = 342,
TLE9104_5_OUT_2 = 343,
TLE9104_5_OUT_3 = 344,

MSIOBOX_0_OUT_1 = 345,
MSIOBOX_0_OUT_2 = 346,
MSIOBOX_0_OUT_3 = 347,
MSIOBOX_0_OUT_4 = 348,
MSIOBOX_0_OUT_5 = 349,
MSIOBOX_0_OUT_6 = 350,
MSIOBOX_0_OUT_7 = 351,
MSIOBOX_0_OUT_8 = 352,
MSIOBOX_0_VSS_1 = 353,
MSIOBOX_0_VSS_2 = 354,
MSIOBOX_0_VSS_3 = 355,
MSIOBOX_0_VSS_4 = 356,
MSIOBOX_0_SW_1 = 357,
MSIOBOX_0_SW_2 = 358,
MSIOBOX_0_SW_3 = 359,
MSIOBOX_0_SW_4 = 360
};

/* Please keep updating these defines */
#define BRAIN_PIN_ONCHIP_LAST	Gpio::K15
#define BRAIN_PIN_ONCHIP_PINS	(BRAIN_PIN_ONCHIP_LAST - Gpio::A0 + 1)
#define BRAIN_PIN_LAST 			Gpio::MSIOBOX_0_SW_4
#define BRAIN_PIN_TOTAL_PINS	(BRAIN_PIN_LAST - Gpio::A0 + 1)
